package tw.singleton.SingleObject;

public class LazyDoubleCheckedSingle {
    private volatile static LazyDoubleCheckedSingle singleton;
    private LazyDoubleCheckedSingle (){}
    public static LazyDoubleCheckedSingle getSingleton() {
        if (singleton == null) {
            synchronized (LazyDoubleCheckedSingle.class) {
                if (singleton == null) {
                    singleton = new LazyDoubleCheckedSingle();
                }
            }
        }
        return singleton;
    }

    public void showMessage(){
        System.out.println("Hello World!懒汉式加载，多线程不安全");
    }

}
